﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SpiritEngine.Source.Utilities
{
    #region Globals

    #endregion


    public static class SE_Misc
    {
        #region Constants/Enums

        #endregion


        #region Structs

        #endregion


        #region Static Member Variables and Methods

        /// <summary>
        /// This function tests whether the passed in value has the specified flag or flags turned on.
        /// </summary>
        /// <param name="value">The value to test.</param>
        /// <param name="flags">The flag or flags to test for.</param>
        /// <returns>True if the specified flag or flags are turned on in the passed in value.</returns>
        public static bool Flags_HasFlags(int value, int flags)
        {
            if ( (value & flags) == flags )
                return true;


            return false;
        }


        /// <summary>
        /// This function sets (turns on) the specified flag bits on the passed in value and returns the result.
        /// </summary>
        /// <param name="value">The value to set the flags on.</param>
        /// <param name="flags">The flags to set.</param>
        /// <returns>Returns the passed in value with the specified flags now set.</returns>
        public static int Flags_SetFlags(int value, int flags)
        {
            return (value |= flags);
        }


        /// <summary>
        /// This function clears (turns off) the specified flag bits on the passed in value and returns the result.
        /// </summary>
        /// <param name="value">The value to clear the flags on.</param>
        /// <param name="flags">The flags to clear.</param>
        /// <returns>Returns the passed in value with the specified flags now cleared.</returns>
        public static int Flags_ClearFlags(int value, int flags)
        {
            return (value &= (~flags));
        }


        /// <summary>
        /// This function toggles the specified flag bits on the passed in value and returns the result.
        /// </summary>
        /// <param name="value">The value to toggle the flags on.</param>
        /// <param name="flags">The flags to toggle.</param>
        /// <returns>Returns the passed in value with the specified flags toggled.</returns>
        public static int Flags_ToggleFlags(int value, int flags)
        {
            return (value ^= flags);
        }

        #endregion


        #region Member Variables

        #endregion


        #region Events/Delegates

        #endregion


        #region Constructors and Destructors (aka Finalizers)

        #endregion


        #region Non-Public Methods

        // This section is for methods that are declared as private, protected, protected internal, or internal.

        #endregion


        #region Public Methods

        #endregion


        #region Interface Methods

        // This section is for methods that are part of the interfaces that the class implements.

        #endregion


        #region Event Invocation Methods

        // This section is for methods that invoke the events of this class.  For example:
        //
        // Invoke the Changed event; called whenever list changes
        // protected virtual void OnChanged(EventArgs e) 
        // {
        //		if (Changed != null)
        //			Changed(this, e);
        // }

        #endregion


        #region Operators

        #endregion


        #region Debug Methods

        // This will compile the debug code only if the DEBUG symbol is defined.
        // To define this symbol for all source files in the project, open the Project Properties,
        // and go to the Build tab.  Check the "Define DEBUG constant" checkbox.  With this box checked,
        // the compiler will automatically define the symbol DEBUG.
#if (DEBUG)
        // put all debug methods in here...
#endif

        #endregion


        #region Properties

        #endregion


    }
}
